package com.zj.leetcode.easy;

/**
 * @program: algorithm
 * @description:
 * @author: Zhang Bo
 * @create: 2022-01-04 15:32
 **/
public class ReverseString {
    public static void main(String[] args) {
        Solution solution = new ReverseString().new Solution();
        char[] s = "a".toCharArray();
        solution.reverseString(s);
        System.out.println(s);
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public void reverseString(char[] s) {
            if (s.length == 0 || s.length == 1) {
                return;
            }
            int i = 0;
            while (i <= ((s.length - 1) / 2)) {
                char temp = s[i];
                s[i] = s[s.length - i - 1];
                s[s.length - i - 1] = temp;
                i++;
            }
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}